<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <title>考勤后台</title>
    <link rel="stylesheet" href="/paiban/base.css" />
    <script src="/static/plugs/jquery/jquery.min.js" type="text/javascript"></script>
    <link rel="stylesheet" href="/static/plugs/layer/layer.css">
    <script src="/static/plugs/layer/layer.js"></script>
    <style type="text/css">
    .form{margin:5px;padding:5px}
    .form input[type='text']{width:100%;padding:5px;border:1px solid #ccc}
        .user{border-bottom:1px solid #ccc;height:40px;}
        .user .bumen,.user .date{float:left;}
        .user .date{margin-left:10px;}
        .months{height:30px;}
        .months .dom{float:left;width:40px;text-align:center;font-size:12px !important;}
        .bans{overflow-y:scroll; height:800px;}
        .bans *{font-size:12px !important;}
        .bans .ban-item{height:40px;background-color:#fefefe;width:100%;height:45px;border-bottom:1px solid #ddd;position:relative;width:100%;}
        .bans .ban-item .xingming{width:40px;float:left;height:40px;line-height:40px;}
        .bans .ban-item .jiaban{width:35px;float:right;height:40px;line-height:40px;position:absolute;right:0px;top:0px;text-align:center}
        .bans .ban-item .item-line{ height:20px; margin-bottom:1px;}
        .bans .ban-item .item-line .shangwu,.bans .ban-item .item-line .xiawu{height:20px;line-height:20px;float:left;text-align:center;width:40px;}
         .bans .ban-item .item-line .shangwu{}
    </style>
  </head>
  <body>
       <div class="wrap">
      {include file="menu"}
     <div class="right">
          <div class="user">
              <div class="bumen">部门：{$bumen.name}</div>
              <div class="date">日期：{$datetime.date}</div>
          </div>
          <div class="months">
              <div class="dom">姓名</div>
              <div class="dom">&nbsp;</div>
              {foreach $months as $v}
              <div class="dom">{$v}</div>
              {/foreach}
              <div class="dom">&nbsp;</div>
          </div>
          <div class="bans">
              {foreach $userban as $ub}
              <div class="ban-item">
                  <div class="xingming">{$ub.name}</div>
                  <div class="item-line">
                      <div class="shangwu">上午</div>
                      <div class="shangwu">{$ub.shangwu['d1']}</div>
                      <div class="shangwu">{$ub.shangwu['d2']}</div>
                      <div class="shangwu">{$ub.shangwu['d3']}</div>
                      <div class="shangwu">{$ub.shangwu['d4']}</div>
                      <div class="shangwu">{$ub.shangwu['d5']}</div>
                      <div class="shangwu">{$ub.shangwu['d6']}</div>
                      <div class="shangwu">{$ub.shangwu['d7']}</div>
                      <div class="shangwu">{$ub.shangwu['d8']}</div>
                      <div class="shangwu">{$ub.shangwu['d9']}</div>
                      <div class="shangwu">{$ub.shangwu['d10']}</div>
                      <div class="shangwu">{$ub.shangwu['d11']}</div>
                      <div class="shangwu">{$ub.shangwu['d12']}</div>
                      <div class="shangwu">{$ub.shangwu['d13']}</div>
                      <div class="shangwu">{$ub.shangwu['d14']}</div>
                      <div class="shangwu">{$ub.shangwu['d15']}</div>
                      <div class="shangwu">{$ub.shangwu['d16']}</div>
                      <div class="shangwu">{$ub.shangwu['d17']}</div>
                      <div class="shangwu">{$ub.shangwu['d18']}</div>
                      <div class="shangwu">{$ub.shangwu['d19']}</div>
                      <div class="shangwu">{$ub.shangwu['d20']}</div>
                      <div class="shangwu">{$ub.shangwu['d21']}</div>
                      <div class="shangwu">{$ub.shangwu['d22']}</div>
                      <div class="shangwu">{$ub.shangwu['d23']}</div>
                      <div class="shangwu">{$ub.shangwu['d24']}</div>
                      <div class="shangwu">{$ub.shangwu['d25']}</div>
                      <div class="shangwu">{$ub.shangwu['d26']}</div>
                      <div class="shangwu">{$ub.shangwu['d27']}</div>
                      <div class="shangwu">{$ub.shangwu['d28']}</div>
                      <div class="shangwu">{$ub.shangwu['d29']}</div>
                      <div class="shangwu">{$ub.shangwu['d30']}</div>
                      <div class="shangwu">{$ub.shangwu['d31']}</div>
                  </div>
                  <div class="item-line">
                      <div class="xiawu">下午</div>
                      <div class="shangwu">{$ub.xiawu['d1']}</div>
                      <div class="shangwu">{$ub.xiawu['d2']}</div>
                      <div class="shangwu">{$ub.xiawu['d3']}</div>
                      <div class="shangwu">{$ub.xiawu['d4']}</div>
                      <div class="shangwu">{$ub.xiawu['d5']}</div>
                      <div class="shangwu">{$ub.xiawu['d6']}</div>
                      <div class="shangwu">{$ub.xiawu['d7']}</div>
                      <div class="shangwu">{$ub.xiawu['d8']}</div>
                      <div class="shangwu">{$ub.xiawu['d9']}</div>
                      <div class="shangwu">{$ub.xiawu['d10']}</div>
                      <div class="shangwu">{$ub.xiawu['d11']}</div>
                      <div class="shangwu">{$ub.xiawu['d12']}</div>
                      <div class="shangwu">{$ub.xiawu['d13']}</div>
                      <div class="shangwu">{$ub.xiawu['d14']}</div>
                      <div class="shangwu">{$ub.xiawu['d15']}</div>
                      <div class="shangwu">{$ub.xiawu['d16']}</div>
                      <div class="shangwu">{$ub.xiawu['d17']}</div>
                      <div class="shangwu">{$ub.xiawu['d18']}</div>
                      <div class="shangwu">{$ub.xiawu['d19']}</div>
                      <div class="shangwu">{$ub.xiawu['d20']}</div>
                      <div class="shangwu">{$ub.xiawu['d21']}</div>
                      <div class="shangwu">{$ub.xiawu['d22']}</div>
                      <div class="shangwu">{$ub.xiawu['d23']}</div>
                      <div class="shangwu">{$ub.xiawu['d24']}</div>
                      <div class="shangwu">{$ub.xiawu['d25']}</div>
                      <div class="shangwu">{$ub.xiawu['d26']}</div>
                      <div class="shangwu">{$ub.xiawu['d27']}</div>
                      <div class="shangwu">{$ub.xiawu['d28']}</div>
                      <div class="shangwu">{$ub.xiawu['d29']}</div>
                      <div class="shangwu">{$ub.xiawu['d30']}</div>
                      <div class="shangwu">{$ub.xiawu['d31']}</div>
                  </div>
                  <div class="jiaban" onclick="setJiaban({$ub.id},'{$datetime.date}')">{$ub.jiaban}</div>
              </div>
              {/foreach}
          </div>
          {if !empty($userban)}
          {$page|raw}
          {/if}
      </div>
     </div>
<script>
    function setJiaban(uid,datetime)
    {
        var htmls='<div class="form"><input type="text" id="days" placeholder="请输入加班天数">';
        htmls+='<input type="hidden" id="user_id" value="'+uid+'">';
        htmls+='<input type="hidden" id="datetime" value="'+datetime+'">';
        htmls+='<input type="button" class="btn btn-primary" id="btn_submit" value="保存" onclick="saveJiaban()">';
        htmls+='</div>';
       layer.open({
           type: 1, 
           content: htmls,
       })
    }
    function saveJiaban()
    {
        var user_id = $("#user_id").val();
        var datetime = $("#datetime").val();
        var days = $("#days").val();
        $.post('/paiban/admin/jiabansave',{user_id:user_id,datetime:datetime,days:days},function(res){
           console.log(res)
           if(res.code==1)
           {
               layer.msg("保存成功");
               location.reload();
           }
           else
           {
               layer.msg("保存失败");
           }
       });
    }
</script>
  </body>
</html>